package loaderlib.LocalCache
{
	import flash.events.EventDispatcher;
	import flash.net.SharedObject;

	/**
	 * one Cahce associated with one object 
	 * 
	 * @author TangZhen
	 * 
	 */
	public class Cache extends EventDispatcher
	{
		
	//	public static var cachedMap:Dictionary = new Dictionary()
		
		public var cachedObject:SharedObject;
		public var name:String;
		public var url:String;
		
		public function Cache(url:String)
		{
			super(null);
			this.name = CachedNameFilter.url2name(url)
			this.url = url
			try
			{
				this.cachedObject = SharedObject.getLocal(this.name)
			}
			catch (e:Error)
			{
			
			};
		}
		
		public function get valid():Boolean
		{
			if(this.cachedObject)
			return true;
			return false;
		}
		
	}
}